package com.bank.controller;

import java.util.Map;

import org.jboss.logging.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.bank.code.RespCode;
import com.bank.entity.RateInfo;
import com.bank.exception.CommonException;
import com.bank.service.RateService;

@Controller
public class RateConrtoller  extends BaseController{
	
	Logger logger = Logger.getLogger(RateConrtoller.class);
	
	@Autowired
	RateService rateService;

	/**
	 * 查询利率
	 * @param params
	 * @return
	 * @throws CommonException
	 */
	@RequestMapping(value="getRateInfo.do", method=RequestMethod.POST)
	public @ResponseBody Map<String,Object> getRateInfo(@RequestBody Map<String,Object> params) throws CommonException{
		logger.debug("开始调用更新机构");
		RateInfo  rateInfo = rateService.getRateInfoById(params);
		if(rateInfo == null){
			throw new CommonException(RespCode.DATA_IS_NULL, " 未查询到数据");
		}else{
			this.setMapValue("rate", rateInfo.getValue());
		}
		return this.setAndGetSuccess();
	}
	
}
